package com.araaya.eslimsmobile.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.araaya.eslimsmobile.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class PointListAdapter extends SimpleAdapter {

	private final Context context;
	ArrayList<HashMap<String, String>> data;
	int resource;
	String[] from;
	int[] to;

	public PointListAdapter(Context context, ArrayList<HashMap<String, String>> data,
			int resource, String[] from, int[] to) {
		super(context, data, resource, from, to);

		this.context = context;
		this.data = data;
		this.resource = resource;
		this.from = from;
		this.to = to;

	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View rowView = inflater.inflate(R.layout.point_list_view,
				parent, false);
		//TextView state = (TextView) rowView.findViewById(R.id.item_subtitle);
		TextView pointTxt = (TextView) rowView.findViewById(R.id.item_title);
		ImageView icon = (ImageView) rowView.findViewById(R.id.icon);
		pointTxt.setText(data.get(position).get("lon")+","+data.get(position).get("lat")
				+","+data.get(position).get("alt"));
		

		return rowView;
	}

}
